<template>
	<view>
		<question-header
		:subject = 'subject' 
		:subjectSize="subjectSize"
		:isHomework="isHomework"
		:homeworkName="homeworkName"></question-header>
		<view class="question">
			<question-stem :subject="subject" :subjectSize="subjectSize" :contentKey='contentKey'></question-stem>
			<single-choice v-if="subject.choiceType!='3'" :choices="subject.subjectChoices" @change='change'></single-choice>
			<multi-choice v-if="subject.choiceType=='3'" :choices="subject.subjectChoices" :selectedChoice="subject.selectChoice" @change='change'></multi-choice>
			<textarea v-if="subject.choiceType=='5'" class="txt" placeholder="填写你的答案" v-model="subject.answerContent"></textarea>
		</view>
	</view>
</template>

<script>
	import {
		isEmpty
	} from '@/utils/index'
	import QuestionHeader from './QuestionHeader';
	import QuestionStem from './QuestionStem';
	import SingleChoice from './SingleChoice';
	import MultiChoice from './MultiChoice';
	export default {
		components: {
			QuestionHeader,
			QuestionStem,
			SingleChoice,
			MultiChoice
		},
		props: {
			subject: {
				type: Object,
				default: function() {
					return {}
				}
			},
			contentKey:{
				type:String,
				default:'subjectDesc'
			},
			isHomework:false,
			homeworkName:'',
			subjectSize: 0
		},
		data() {
			return {}
		},
		methods: {
			change(value) {
				// console.log('选项',value);
				this.$emit('change', value);
			},
		}
	}
</script>

<style lang="scss" scoped>
	.question {
		border-radius: 8rpx;
		box-shadow: 0 0 10upx #eaeaea;
		padding: 30upx 30upx;
		font-size: 30upx;
		margin: 20upx;
		margin-bottom: 40upx;
	}
</style>
